#ifndef _MYCONTEXT_H_
#define _MYCONTEXT_H_

#ifdef _WIN32
#  define USE_MIDI_FUNCTIONS
#else
//#  define USE_GLOVEPIE
#endif

// Local Includes
#include "MyImage.h"
#include "MyFont.h"

// SDL Includes
#include <SDL_opengl.h>

// System Includes

#define NUM_INSTS 6
#define NUM_MOTES 1

typedef unsigned int MyTexObj;
const MyTexObj WINDOW_BACKGROUND_TEX  = 0;
const MyTexObj SPLASH_SCREEN          = 1;
const MyTexObj MENU_TEX               = 2;
const MyTexObj LAST_TEX_OBJ           = 3;


// TOXIC:  VERIFY that these are the correct order
typedef unsigned int MyInstrumentTexObj;
const MyInstrumentTexObj INST_BASE_HIGHMIDTOM    = 0;
const MyInstrumentTexObj INST_BASE_BASSDRUM      = 1;
const MyInstrumentTexObj INST_BASE_HIHAT         = 2;
const MyInstrumentTexObj INST_BASE_LOWTOM        = 3;
const MyInstrumentTexObj INST_BASE_SNARE         = 4;
const MyInstrumentTexObj INST_BASE_CRASHCYMBAL   = 5;

const unsigned int INST_TOP  = 0;
const unsigned int INST_SIDE = 1;

class MyContext
{
  public:
    MyContext();
    ~MyContext();

    bool configure();

    const MyImage* texture( MyTexObj id ) const          
      { return &_texture[id]; }
    const MyImage* instrument( MyInstrumentTexObj id ) const
      { return &_instrument[id]; }

    bool renderText( char* pStr, int x, int y ) const;
    bool renderSplash( MyTexObj id, unsigned int uiTime, 
                       float fCentX, float fCentY, 
                       float fTexW, float fTexH, 
                       bool bClear=true ) const;
    bool renderLights( float fLight[][4], unsigned short _usCount);
    bool renderRect( float x, float y, float w, float h ) const;
    bool renderCircle(float fX, float fY, float fZ, float fRad, float fInRad = 0.0f, int iSides=20, float fZOffset = 0.0f);
    bool renderTopCircle(float fX, float fY, float fZ, float fRad, float fInRad = 0.0f, int iSides=20, float fZOffset = 0.0f);
    bool renderCircle(float fCircle[][8], int iSides);
    bool renderCylinder(float fRenderSize[3], float fRenderPos[3], float fRotate[4], unsigned int uiType);
    bool renderCone(float fRenderSize[3], float fRenderPos[3], float fRotate[4], unsigned int uiType);
        
    bool renderTexRect( MyTexObj i, const float *fCol, 
                        float x, float y, 
                        float w, float h ) const;

    bool buildCircle(float fCircle[][8], float fX, float fY, float fZ, float fRad, float fInRad = 0.0f, int iSides=20, float fZOffset = 0.0f);
    
  protected:
    bool _norm(float fX, float fY, float fZ, float fNorm[3]);

  protected:
    // Textures
    MyImage     _texture[LAST_TEX_OBJ];
    MyImage     _instrument[NUM_INSTS];
    MyImage     _3dTex[NUM_INSTS][2];

    // Fonts
    MyFont      _font;
#ifndef __APPLE_CC__
    // OpenGL Extensions
   public:
    PFNGLACTIVETEXTUREPROC     _glActiveTexture;
#endif
};

#endif  // _MYCONTEXT_H_
